package com.itheima.test04;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class BigDecimalTest {
    public static void main(String[] args) {
        System.out.println(0.1+0.2);

        BigDecimal bd1 = new BigDecimal("0.1");
        BigDecimal bd2 = new BigDecimal("0.3");

        System.out.println("和为："+bd1.add(bd2));
        System.out.println("差为："+bd1.subtract(bd2));
        System.out.println("积为："+bd1.multiply(bd2));
        System.out.println("商为："+bd1.divide(bd2,2, RoundingMode.HALF_DOWN));
    }
}
